home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -readerstuff- / steve_glover / source-code / app.c next >
C/C++ Source or Header  |  1999-04-21  |  5KB  |  208 lines

  1.  
  2.    /***********************************************************************
  3.    *                                                                      *
  4.    *                            COPYRIGHTS                                *
  5.    *                                                                      *
  6.    *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
  7.    *   This file was modified by © Zinneberg-Soft.                        *
  8.    ***********************************************************************/
  9.  
  10. /* custom.c This file contains the custom code for a commodity  */
  11. /* you should be able to write a new commodity by changing only */
  12. /* custom.c and custom.h */
  13. #include "blanker_rev.h"
  14. #include "app.h"
  15. #if WINDOW
  16. struct EasyStruct aboutcybereasy =
  17.     {
  18.  
  19.     sizeof(struct EasyStruct),
  20.    
  21.     0,
  22.     "About CyberBlanker",
  23.     "CyberBlanker ©99 Zinneberg-Soft\n"
  24.     VSTRING   /* Use version String */
  25.     "V = vertical blank. \n"
  26.     "H = horizontal blank. \n"
  27.     "H/V = horizontal/vertical blank. \n"
  28.     "Spell the word immortal  (Five letters.)\n"
  29.     "                  enjoy.",
  30.     "OK",
  31.  };
  32.  
  33. /*************/
  34. struct EasyStruct progconfig =
  35.     {
  36.  
  37.     sizeof(struct EasyStruct),
  38.  
  39.     0,
  40.     "CyberBlanker Configuration",
  41.     "The following ToolTypes can also\n"
  42.     "be given as Shell parameters.\n"
  43.     " \n"
  44.     "DONOTWAIT \n"
  45.     "PUBSCREEN=DOPUS.1 \n"
  46.     "FONTNAME=helvetica.font \n"
  47.     "FONTSIZE=15 \n"
  48.     "SECONDS=120 \n"
  49.     "WINDOWX=134 \n"
  50.     "WINDOWY=64 \n"
  51.     "CX_POPUP=YES  (YES/NO) \n"
  52.     "CX_PRIORITY=0 \n"
  53.     "CX_POPKEY=SHIFT F1 \n"
  54.     "DPMS=OFF  (H/V/OFF) \n"
  55.     "            enjoy.",
  56.     "OK",
  57.  
  58.  };
  59.  
  60. /************/
  61. #define V(x) ((VOID *)x)
  62. VOID setupCustomGadgets(gad)
  63. struct Gadget **gad;
  64. {
  65.    mysetupCustomGadgets(gad);
  66. }
  67. VOID HandleGadget(gad,code)
  68. ULONG gad,code;
  69. {
  70. myHandleGadget(gad,code);
  71. }
  72. VOID setupCustomMenu()
  73. {
  74. struct NewMenu mynewmenu [] =
  75. {
  76.     { NM_TITLE, "Project",   0 ,  0, 0, 0,            },
  77.     { NM_ITEM,  "Hide",     "X",  0, 0, V(MENU_HIDE), },
  78.     { NM_ITEM, "DPMS LEVEL", 0 ,  0, 0, 0,            },
  79.     { NM_SUB,   "OFF",      "O",  0, 0, V(SHOW_V_H),  },
  80.     { NM_SUB, "V/BLANK",    "V",  0, 0, V(SHOW_V),    },
  81.     { NM_SUB, "H/BLANK",    "H",  0, 0, V(SHOW_H),    },
  82.     { NM_ITEM, "About",     "?",  0, 0, V(SHOW_ABOUT),},
  83.     { NM_ITEM, "Config",    "C",  0, 0, V(CONFIG),    },
  84.  /* { NM_ITEM, "SaveConfig",    "S",  0, 0, V(SAVE_CONFIG),    }, */
  85.     { NM_ITEM, NM_BARLABEL,  0 ,  0, 0, 0,            },
  86.     { NM_ITEM, "Quit",      "Q",  0, 0, V(MENU_DIE),  },
  87.     { NM_END,  0,            0,   0, 0, 0             },
  88. };
  89.  
  90.  
  91.    menu=CreateMenus(mynewmenu,TAG_DONE);
  92.    D( kprintf("custom: CreateMenus returns menu =  %lx\n",menu); )
  93. }
  94.  
  95.  
  96. VOID handleCustomMenu(code)
  97.    ULONG code;
  98. {
  99.    struct MenuItem *item;
  100.    BOOL terminated=FALSE;
  101.  
  102.    D( kprintf("custom: handleCustomMenu(code=%lx)\n",code); )
  103.    while((code!=MENUNULL)&&(!terminated))
  104.    {
  105.       item=ItemAddress(menu,code);
  106.       switch((int)MENU_USERDATA(item))
  107.       {
  108.          case MENU_HIDE:
  109.                shutdownWindow();
  110.                terminated=TRUE; /* since window is gone NextSelect is invalid so...*/
  111.                break;
  112.  
  113.          case SHOW_ABOUT:
  114.                SHOWABOUT();
  115.                break;
  116.  
  117.          case CONFIG:
  118.                SHOWCONFIG();
  119.                break;
  120.  
  121.       /*   case SAVE_CONFIG:
  122.                SAVECONFIG();
  123.                break; */
  124.  
  125.          case SHOW_V:
  126.               {
  127.               SSET_DPMS_SUSPEND();
  128.               break;
  129.               }
  130.  
  131.          case SHOW_H:
  132.               {
  133.               SSET_DPMS_STANDBY();
  134.               break;
  135.               }
  136.  
  137.          case SHOW_V_H:
  138.               {
  139.               SSET_DPMS_OFF();
  140.               break;
  141.               }
  142.  
  143.          case MENU_DIE:
  144.                terminate();
  145.                break;
  146.          default:
  147.                break;
  148.       }
  149.       code=item->NextSelect;
  150.       D( kprintf("custom: handleCustomMenu next code=%lx\n",code); )
  151.    }
  152.    D( kprintf("custom: handleCustomMenu exits"); )
  153. }
  154. VOID refreshWindow()
  155. {
  156.    if(window)
  157.    {
  158.       if(IDCMPRefresh)
  159.          GT_BeginRefresh( window );
  160.       if(IDCMPRefresh)
  161.          GT_EndRefresh( window, 1L );
  162.  
  163.       /* It is possible that the user has selected a font so large      */
  164.       /* that our imagery will fall off the bottom of the window        */
  165.       /* we RefreshWindowFrame here incase our borders were overwritten */
  166.       if((topborder+WINDOW_INNERHEIGHT) > window->Height)
  167.          RefreshWindowFrame(window);
  168.    }
  169.    return;
  170. }
  171.  
  172. #endif /* WINDOW */
  173.  
  174. BOOL setupCustomCX()
  175. {
  176. return(setupBlanker());
  177. }
  178. VOID shutdownCustomCX()
  179. {
  180. }
  181. VOID handleCustomCXMsg(id)
  182. ULONG id;
  183. {
  184.    switch(id)
  185.    {
  186.       case 0:
  187.       default:
  188.             break;
  189.    }
  190. }
  191.  
  192. VOID handleCustomCXCommand(id)
  193. ULONG id;
  194. {
  195.    switch(id)
  196.    {
  197.       case 0:
  198.       default:
  199.       break;
  200.    }
  201. }
  202. #if CSIGNAL
  203. VOID handleCustomSignal(VOID)
  204. {
  205. MyHandleCustomSignal();
  206. }
  207. #endif
  208.